package logic

import (
	"news/dao/mysql"
	"news/models"

	"go.uber.org/zap"
)

func CreateGroup(p *models.Group) (err error) {
	//检查组名是否有重名
	err = mysql.CheckGroupExit(p.Type)
	if err != nil {
		return err
	}
	err = mysql.CreateGroupDataSave(p)
	if err != nil {
		zap.L().Error("mysql.CreateGroupDataSave failed", zap.Error(err))
		return err
	}
	return
}
